package chat.user;

import java.io.Serializable;
import java.net.Socket;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.TreeSet;
import java.util.Vector;

import chat.ui.GroupChatWindow;

public class Message implements Serializable {
	
	public boolean GROUP_UPDATE=false;
	public static boolean USER_UPDATE=false;
	public boolean NEW_GROUP_REQUEST=false;
	public boolean AUTH_REQUEST=false;
	public boolean SEND_MESSAGE=false;
	public boolean CONNECT_TO_GROUP=false;
	private String user_group;
	private ArrayList<Group> group_list;
	private String Username, message;
	private User user;
	private Vector<String> group_name_list= new Vector<String>();
	private Socket receiver_socket;
	private String new_group_name;
	//private static User user = GroupChatWindow.getUser();
	
	public Message(String mes){
		
		this.message = mes;
		
	}
	public Message(String mes, User u){
		
		message = mes;
		user = u;
	}
	
	public Message(User u){
		
		user = u;
		
	}
	public Message(Socket s){
		
		receiver_socket = s;
		
	}
	
	public Message (Socket s, String mes, boolean SEND_MESSAGE){
		
		this.receiver_socket = s;
		
		this.message = mes;
		
		
	}
		
	public User getUser(){
		return user;
	}	
	public String getGroup(){
		
		return this.user_group;
		
	}
	public void setUserGroup(String group_name){
		
		this.user_group = group_name;
	}
	public ArrayList<Group> setGroupList(ArrayList<Group> list){
		
		group_list= list;
		
		return group_list;
		
	}
	public ArrayList<Group> getGroupList(){
		
		return group_list;
		
	}
	public String getUserName(){
		return  this.Username;
	}
	public String getMessage(){
		return  this.message;
	}
	public String setMessage(String IncomingMessage){
		return  this.message=IncomingMessage;
	}
	public Vector<String> setGroupNames(Vector<Group> g){
		
		for (Group p: g){
			
			String g_name = p.getName();
			
			group_name_list.add(g_name);
			
		}
		
		return this.group_name_list;
		
	}
	
	public Vector<String> getGroupNames(){
		return this.group_name_list;
	}
	
	public Socket getReceiverSocket(){
		
		return this.receiver_socket;
	}
	
	public void setReceiverSocket(Socket s){
		
		this.receiver_socket = s;
	}
	
	public void removeReceiverSocket(){
		receiver_socket=null;
	}
	
	public void setUser(User u){
		
		this.user = u;
	}
	
	public void setNewGroup(String group_name){
		
		this.new_group_name = group_name;
	}
	
	public String getNewGroup(){
		
		return this.new_group_name;
	}

}
